package com.msl.debezium;

import com.msl.debezium.common.RedisDbKeyListener;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * (scanBasePackages = {"com.msl.debezium"})
 */
@Slf4j
@EnableEurekaClient
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableScheduling
public class DebeziumCdcApplication implements CommandLineRunner {

    @Autowired
    private RedisDbKeyListener redisDbKeyListener;

    public static void main(String[] args) {
        SpringApplication.run(DebeziumCdcApplication.class, args);
        log.info("这是log");
    }

    /**
     * 数据的预加载
     * @param args
     * @throws Exception
     */
    @Override
    public void run(String... args) throws Exception {
        //预加载datasource的类型vm/win后修改swagger的首页信息
        redisDbKeyListener.changeDb();
    }



}
